home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
023a
/
fm40.zip
/
FMMTH.HLP
< prev
next >
Wrap
Text File
|
1991-10-05
|
7KB
|
173 lines
**************************** Math Operations Help ****************************
Defining math operations allows use of addition, subtraction, multiplication,
division, and powers (including square roots) to solve equations posed by your
forms. When performed, numbers are taken from fields in your form, or from
the equations you define, and then processed. Results are loaded into fields
of your form in various formats such as integer, floating point, and
scientific notation.
There are 16 lines on this special form in which you may enter 1 or more
mathematical equations. Each equation must fit entirely on a line, it can not
span two lines. Equations on the same line must be separated by a space
except when merging (explained later). They are processed in order from left
to right, then top to bottom. Equations have the following form:
Expression=Result Example: #15*#16/100=#17
"#15*#16/100" is the expression and "#17" is the result. This expression
consists of the three operands: "#15" for field 15, "#16" for field 16, and
"100". There are two operators: "*" for multiplication, and "/" for
division. In this example fields 15 and 16 are multiplied together, divided
by 100, then placed into field 17.
Rules for expressions:
o Consist of 1 or more operands each separated by an operator:
+, -, *, /, and ^.
o An expression must begin and end with an operand with one
exception: it may begin with a -.
o Expressions are evaluated left to right. They are written in a
manner similar to the way you would use a simple calculator.
Rules for operands:
o May be contents of a field, a number, or 1 of 20 registers
(memories).
o The contents of a field are represented by the number of that
field preceded by a #. Example: contents of field 15 are
"#15". A field number may be followed by an "@" sign and a
positive integer to perform stepping that simplify long
repetitive expressions. Example: "#15@3". See STEPPING at
end of this section.
o A number can be an integer or decimal number up to 60 digits
long. It must be positive.
o The 20 registers are represented by the capitol letters A
through T. They are initially zero when Form Master starts.
Operators:
Addition +
Subtraction -
Multiplication *
Division /
Power ^
Rules for results:
o Can be loaded into a field, or into 1 of 20 registers.
o A field used for output is specified by the number of that field
preceded by a # and followed by a colon and the output format.
Example: #17:F8.2 "F8.2"is the format. A default format of
F6.2 is assumed if the colon and format are left off. The default
allows for numbers ranging from "-99.99" to "999.99".
o The 20 registers are represented by the capitol letters A through T.
Rules for formats:
o Possible formats are: "Iw", "Fw.d", and "Ew.d".
o "Iw" is an integer format (no decimal point) "w" digits wide.
Example: 35.4 loaded into a field using an I3 format becomes " 35".
o "Fw.d" is a floating point format (with decimal point) "w"
digits wide with "d" digits following the decimal point.
Example: 35.4 loaded into a field using an F5.2 format becomes
"35.40".
o "Ew.d" is a floating point format (with decimal point) using
scientific notation which is "w" digits wide with "d" digits
following the decimal point. Example 35.4 loaded with E10.3
becomes " .354E+02".
o Any number which requires more than "w" digits to load will
cause the field to fill with "*'s".
o A format cannot specify more characters "w" than the field is
wide or an error will result during execution.
Examples:
Two equations placed on the same line:
#1+#2/100=#3:F5.2 #1+#3*#7=#8:I8
(1) Add fields 1 and 2, divide by 100, then place in field 3 as
number xx.xx, (5 digits wide with 2 decimal places)
(2) Field 7 times sum of fields 1 and 3, place into field 8 as
xxxxxxxx, (8 digits wide)
Use of square root and temporary value:
#1+#2=A #3+#4*A^.5=#5:E9.4
Square root of ( ( sum of fields 1 and 2 ) times ( sum of fields 3
and 4 ) ), place result into field 5 as .xxxxE+xx.
Note the use of the temporary register "A" to hold the sum of fields
1 and 2. This is necessary since parenthesis are not allows in the
equations.
Equation beginning with a "-" and using the default format:
-#1=#2
Field 2 is written as xxx.xx and is the negative of field 1.
Merging:
If the result of an equation is used as the first operand in the next
equation, the two equations can be merged to save space. Suppose you want
field 3 to be sum of fields 1 and 2, then field 5 to be the product of fields
3 and 4. The following two equations:
#1+#2=#3:I4 #3*#4=#5
can be merged by removing the " #3" at the beginning of the second equation.
The result is:
#1+#2=#3:I4*#4=#5
The following equation shows a way to make field 3 be the square of the sum of
fields 1 and 2:
#1+#2=A*A=#3
Stepping:
Long repetitive expressions involving multiplication, addition, and
subtraction can be simplified using a stepping option. In expressions where
the operation is the same over uniformly spaced fields (field number
increments by some constant), only the first and last field numbers and a
stepping count are specified:
#1+#2+#3+#4+#5=#6 can be replaced by #1+#5@1=#6
#4*#8*#12*#16+#17=#18 can be replaced by #4*#16@4+#17=#18
#7-#9-#11-#13=#15 can be replaced by #7-#13@2=#15
Only positive step counts are allowed. The last field number minus the first
field number in the stepping loop must be positive and a multiple of the step
count.
Notes:
Use F6 to display all the fields in order with their number, row, column, and
size. (F6 has been redefined on this form to display the file FIELDS.LST.)
If your form is edited in such a way that fields are added, removed, or their
ordering is changed, you must make corresponding changes here to account for
the changes in the field numbers. Otherwise, the math feature may not work
properly.
To right justify the result in the field, use the word processing features
form to define that field as right justified. The same is true for left and
center justification.
Double precision arithmetic (IEEE standard) is used for all math operations.
This has approximately 15 significant digits of accuracy. All numbers are
converted to double precision before use. Results placed into fields are
rounded to the displayed precision.
Entries made on this form are not checked until math is performed during form
execution. Improperly defined equations will cause the math operations to
terminate early and display an error message. This is also true for fields
that do not contain a valid number, and such conditions such as divide by
zero, overflow, etc.